package com.adam.blog.handler;


import com.adam.blog.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

//对加了Controller注解的方法进行拦截处理 AOP的实现
@ControllerAdvice
public class AllExceptionHandler {
    //进行异常处理，处理Exception.class异常
    @ExceptionHandler(Exception.class)
    @ResponseBody
   public Result doException(Exception exception){
        //未使用到日志
        exception.printStackTrace();
        return Result.fail(-999,"系统异常");
    }
}
